home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / graphics / bitlin / main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-23  |  28.7 KB  |  791 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    BackColor       =   &H00FFFFFF&
  4.    Height          =   5400
  5.    Icon            =   MAIN.FRX:0000
  6.    Left            =   1125
  7.    LinkTopic       =   "Form2"
  8.    ScaleHeight     =   4710
  9.    ScaleWidth      =   4260
  10.    Top             =   1020
  11.    Width           =   4380
  12.    Begin PictureBox picTemp 
  13.       AutoRedraw      =   -1  'True
  14.       BorderStyle     =   0  '
  15.       Height          =   735
  16.       Left            =   360
  17.       ScaleHeight     =   735
  18.       ScaleWidth      =   3975
  19.       TabIndex        =   7
  20.       Top             =   840
  21.       Visible         =   0   'False
  22.       Width           =   3975
  23.    End
  24.    Begin ODListBox ODLSample 
  25.       Height          =   2535
  26.       HelpContextID   =   3002
  27.       HScroll         =   0   'False
  28.       IconIdxArray    =   0   'False
  29.       ItemBackColor   =   &H00000000&
  30.       ItemHeight      =   0
  31.       Left            =   0
  32.       MultiSelect     =   0  '
  33.       Sort            =   0   'False
  34.       Sorted          =   0   'False
  35.       TabIndex        =   6
  36.       Top             =   480
  37.       Width           =   2175
  38.    End
  39.    Begin PictureBox PicControl 
  40.       Align           =   1  '
  41.       BackColor       =   &H00C0C0C0&
  42.       FillColor       =   &H00FFFFFF&
  43.       Height          =   495
  44.       HelpContextID   =   3002
  45.       Left            =   0
  46.       ScaleHeight     =   465
  47.       ScaleWidth      =   4230
  48.       TabIndex        =   0
  49.       Top             =   0
  50.       Width           =   4260
  51.       Begin TextBox txtHeight 
  52.          Height          =   285
  53.          Left            =   1095
  54.          TabIndex        =   3
  55.          Text            =   "34"
  56.          Top             =   75
  57.          Width           =   615
  58.       End
  59.       Begin Image ImgRight2 
  60.          Height          =   375
  61.          Left            =   6600
  62.          Picture         =   MAIN.FRX:0302
  63.          Top             =   120
  64.          Visible         =   0   'False
  65.          Width           =   360
  66.       End
  67.       Begin Image ImgRight1 
  68.          Height          =   375
  69.          Left            =   6000
  70.          Picture         =   MAIN.FRX:04A8
  71.          Top             =   120
  72.          Visible         =   0   'False
  73.          Width           =   360
  74.       End
  75.       Begin Image Imgleft2 
  76.          Height          =   375
  77.          Left            =   5640
  78.          Picture         =   MAIN.FRX:064E
  79.          Top             =   120
  80.          Visible         =   0   'False
  81.          Width           =   360
  82.       End
  83.       Begin Image Imgleft1 
  84.          Height          =   375
  85.          Left            =   5160
  86.          Picture         =   MAIN.FRX:07F4
  87.          Top             =   120
  88.          Visible         =   0   'False
  89.          Width           =   360
  90.       End
  91.       Begin Image Imgsave1 
  92.          Height          =   330
  93.          Left            =   4320
  94.          Picture         =   MAIN.FRX:099A
  95.          Top             =   120
  96.          Visible         =   0   'False
  97.          Width           =   375
  98.       End
  99.       Begin Image Imgsave2 
  100.          Height          =   330
  101.          Left            =   4680
  102.          Picture         =   MAIN.FRX:0B74
  103.          Top             =   120
  104.          Visible         =   0   'False
  105.          Width           =   345
  106.       End
  107.       Begin Image imgRight 
  108.          Height          =   330
  109.          Left            =   2865
  110.          Picture         =   MAIN.FRX:0CF6
  111.          Stretch         =   -1  'True
  112.          Top             =   75
  113.          Width           =   375
  114.       End
  115.       Begin Image imgLeft 
  116.          Height          =   330
  117.          Left            =   2445
  118.          Picture         =   MAIN.FRX:0E9C
  119.          Stretch         =   -1  'True
  120.          Top             =   75
  121.          Width           =   375
  122.       End
  123.       Begin Image imgSave 
  124.          Height          =   330
  125.          Left            =   1920
  126.          Picture         =   MAIN.FRX:1042
  127.          Stretch         =   -1  'True
  128.          Top             =   75
  129.          Width           =   375
  130.       End
  131.       Begin Label lblHeight 
  132.          BackColor       =   &H00C0C0C0&
  133.          Caption         =   "Item Height:"
  134.          Height          =   255
  135.          Left            =   120
  136.          TabIndex        =   2
  137.          Top             =   120
  138.          Width           =   975
  139.       End
  140.    End
  141.    Begin PictureBox picStatus 
  142.       Align           =   2  '
  143.       BackColor       =   &H00C0C0C0&
  144.       Height          =   1095
  145.       Left            =   0
  146.       ScaleHeight     =   1065
  147.       ScaleWidth      =   4230
  148.       TabIndex        =   1
  149.       Top             =   3615
  150.       Width           =   4260
  151.       Begin TextBox txtBitName 
  152.          BackColor       =   &H00FFFFFF&
  153.          Height          =   285
  154.          HelpContextID   =   3002
  155.          Index           =   0
  156.          Left            =   120
  157.          TabIndex        =   5
  158.          Top             =   45
  159.          Width           =   645
  160.       End
  161.       Begin PictureBox picBitmaps 
  162.          BorderStyle     =   0  '
  163.          Height          =   615
  164.          HelpContextID   =   7000
  165.          Index           =   0
  166.          Left            =   120
  167.          ScaleHeight     =   615
  168.          ScaleWidth      =   615
  169.          TabIndex        =   4
  170.          Top             =   360
  171.          Width           =   615
  172.       End
  173.       Begin Image ImgBitmaps 
  174.          Height          =   495
  175.          Index           =   0
  176.          Left            =   120
  177.          Stretch         =   -1  'True
  178.          Top             =   360
  179.          Width           =   735
  180.       End
  181.    End
  182.    Begin Menu mnuFile 
  183.       Caption         =   "&File"
  184.       HelpContextID   =   6000
  185.       Begin Menu mnuNew 
  186.          Caption         =   "&New"
  187.       End
  188.       Begin Menu mnuOpen 
  189.          Caption         =   "&Open"
  190.       End
  191.       Begin Menu mnuSave 
  192.          Caption         =   "&Save"
  193.       End
  194.       Begin Menu mnuSaveAs 
  195.          Caption         =   "Save&As"
  196.       End
  197.       Begin Menu mnuSep2 
  198.          Caption         =   "-"
  199.       End
  200.       Begin Menu mnuExit 
  201.          Caption         =   "E&xit"
  202.       End
  203.    End
  204.    Begin Menu mnuEdit 
  205.       Caption         =   "&Edit"
  206.       HelpContextID   =   7000
  207.       Begin Menu mnuInsert 
  208.          Caption         =   "&Insert"
  209.       End
  210.       Begin Menu mnuAppend 
  211.          Caption         =   "&Append"
  212.       End
  213.       Begin Menu menSep3 
  214.          Caption         =   "-"
  215.       End
  216.       Begin Menu mnuBMPFile 
  217.          Caption         =   "&BMPFile"
  218.       End
  219.       Begin Menu mnuSep4 
  220.          Caption         =   "-"
  221.       End
  222.       Begin Menu mnuCopy 
  223.          Caption         =   "&Copy"
  224.       End
  225.       Begin Menu mnuPaste 
  226.          Caption         =   "&Paste"
  227.       End
  228.       Begin Menu mnuClear 
  229.          Caption         =   "C&lear"
  230.       End
  231.       Begin Menu mnuDelete 
  232.          Caption         =   "&Delete"
  233.       End
  234.    End
  235.    Begin Menu mnuView 
  236.       Caption         =   "&View"
  237.       HelpContextID   =   3002
  238.       Begin Menu mnuSample 
  239.          Caption         =   "&Show sample"
  240.       End
  241.    End
  242.    Begin Menu mnuHelp 
  243.       Caption         =   "&Help"
  244.       Begin Menu mnuContents 
  245.          Caption         =   "&Contents"
  246.       End
  247.       Begin Menu mnuSearch 
  248.          Caption         =   "&Search for Help on..."
  249.       End
  250.       Begin Menu mnuHowto 
  251.          Caption         =   "&How to use Help"
  252.       End
  253.       Begin Menu mnuAbout 
  254.          Caption         =   "&About"
  255.       End
  256.    End
  257. 'Option Explicit
  258. Dim cntBitmaps              'number of bitmaps images
  259. Dim selBitmap               'index of selected bitmap, -1 if none selected
  260. Dim MouseButton
  261. Dim startp() As Integer     'starting position of items in ODList
  262. Dim fname As String         'file name
  263. Sub displayBMP (Index As Integer)
  264. 'Display BMP image in Bitmap image box
  265. '  Bitmap image is displayed in imgBitmaps()
  266. '  PicBitmaps() is hidden (empty box)
  267. 'Insert full path
  268. procInsPath
  269. 'Display picture
  270. imgBitmaps(Index).Picture = LoadPicture(frmGetFile.Tag)
  271. picBitmaps(Index).Visible = False
  272. End Sub
  273. 'Copyright 1995 by Hitoshi Ozawa
  274. Sub Form_Activate ()
  275. 'Set main form caption
  276. If fname = "" Then                         'if no file name than
  277.  frmMain.Caption = "Bitmap Image Liner"       'set main form caption as Bitmap Image Liner
  278. Else                                       'If there is a file - ie. it was saved once
  279.  frmMain.Caption = fname                       'set main form caption as name of a file
  280. End If
  281. End Sub
  282. 'Copyright 1995 by Hitoshi Ozawa
  283. Sub Form_Load ()
  284. 'Set Help file name
  285. HelpFileName = App.Path
  286. If Right$(App.Path, 1) <> "\" Then
  287.  HelpFileName = HelpFileName + "\"
  288. End If
  289. HelpFileName = HelpFileName + "bitlin.hlp"
  290. App.HelpFile = HelpFileName
  291. 'Show Tao cursor while in LHA operation
  292. retcode = LhaSetCursorMode(1)
  293. 'Set size of buffer to use in LHA.DLL
  294. szbuff = 4052
  295. 'Set which form is currently being displayed
  296. curForm = fMain
  297. ' Load the frmGetFile dialog box without displaying
  298. Load frmGetFile
  299. 'Initialize the cboFileType combo box of the frmGetFile
  300. frmGetFile.cboFileType.AddItem "Text files (*.BMP)"   'Add BMP as first pattern
  301. frmGetFile.cboFileType.AddItem "All files (*.*)"      'All files as second
  302. frmGetFile.cboFileType.AddItem "LHA files (*.LZH)"    'LZH files as third
  303. frmGetFile.cboFileType.ListIndex = 0                  'Default file pattern to 1st pattern(ie. BMP)
  304. 'Initialization
  305. cntBitmaps = 1      'Number of bitmaps
  306. selBitmap = -1      'Currently selected bitmap image (-1 = no selection)
  307. 'Set height of bitmap images
  308. txtHeight_LostFocus
  309. End Sub
  310. 'Copyright 1995 by Hitoshi Ozawa
  311. Sub Form_resize ()
  312. 'Be sure that all bitmap images are displayed on screen
  313. 'Is the last bitmap location + width of bitmap greater than width of a form
  314. '  ie. if lined bitmap image going past the main form?
  315. If (picBitmaps(cntBitmaps - 1).Left + picBitmaps(0).Width) > frmMain.Width Then
  316.   frmMain.Width = picBitmaps(cntBitmaps - 1).Left + picBitmaps(cntBitmaps - 1).Width * 1.5
  317. End If
  318. 'Is the height of bitmaps sufficient?
  319. If (frmMain.ScaleHeight - picControl.ScaleHeight - picStatus.ScaleHeight) < (Val(txtHeight.Text) * screen.TwipsPerPixelY) Then
  320.  frmMain.Height = frmMain.ScaleHeight + picControl.ScaleHeight + picStatus.ScaleHeight
  321. End If
  322. 'Set the width of the control box (Item Height and arrow buttons)
  323. picControl.ScaleWidth = frmMain.ScaleWidth
  324. 'Readjust ODList box width and height
  325. ODLSample.Width = frmMain.ScaleWidth
  326. ODLSample.Height = frmMain.ScaleHeight - picControl.ScaleHeight - picStatus.ScaleHeight
  327. End Sub
  328. 'Copyright 1995 by Hitoshi Ozawa
  329. Sub ImgBitmaps_Click (Index As Integer)
  330. 'Bitmap image was selected - ie. bitmap image box with a picture was selected
  331. If imgBitmaps(Index).BorderStyle = 1 Then    'If the selected bitmap box is already selected, then unselect it
  332.  imgBitmaps(Index).BorderStyle = 0              'turn borders of both image and picture box to 0 - no borders
  333.  picBitmaps(Index).BorderStyle = 0
  334.  txtBitName(Index).BackColor = RGB(256, 256, 256)   'set color of corresponding item name box to white
  335.  selBitmap = -1                                     'set selected bitmap box to none
  336. Else                                          'If the currently selected bitmap is not selected
  337.  If selBitmap > -1 Then                          'check if other bitmap box is currently selected
  338.   imgBitmaps(selBitmap).BorderStyle = 0            'if some other box is selected, unselect it
  339.   picBitmaps(selBitmap).BorderStyle = 0              'turn border off
  340.   txtBitName(selBitmap).BackColor = RGB(256, 256, 256)    'set color of corresponding item name box to white
  341.  End If
  342.  imgBitmaps(Index).BorderStyle = 1                 'Set the selected bitmap box as selected
  343.  picBitmaps(Index).BorderStyle = 1                 'change border to a line
  344.  txtBitName(Index).BackColor = RGB(160, 240, 120)  'change color of corresponding item name box
  345.  selBitmap = Index                                 'set selected bitmap box index
  346. End If
  347. End Sub
  348. 'Copyright 1995 by Hitoshi Ozawa
  349. Sub ImgBitmaps_DragDrop (Index As Integer, Source As Control, X As Single, Y As Single)
  350. 'a new bitmap image was dropped to the bitmaps image box
  351. displayBMP Index             'replace the current bitmap with a new bitmap image
  352. End Sub
  353. 'Copyright 1995 by Hitoshi Ozawa
  354. Sub ImgBitmaps_DragOver (Index As Integer, Source As Control, X As Single, Y As Single, state As Integer)
  355. Select Case state
  356.   Case 0
  357.     'change icon when over
  358.     frmGetFile.filFiles.DragIcon = frmGetFile.picFile2
  359.   Case 1
  360.     'change icon to release
  361.     frmGetFile.filFiles.DragIcon = frmGetFile.PicFile1
  362. End Select
  363. End Sub
  364. Sub imgLeft_Click ()
  365.  If MouseButton = 1 Then
  366.   imgLeft.Picture = imgLeft1.Picture
  367.   MouseButton = 0
  368.  Else
  369.   imgRight.Picture = imgRight1.Picture
  370.   imgLeft.Picture = imgLeft2.Picture
  371.   MouseButton = 1
  372.  End If
  373. End Sub
  374. Sub imgRight_Click ()
  375.  If MouseButton = 2 Then
  376.   imgRight.Picture = imgRight1.Picture
  377.   MouseButton = 0
  378.  Else
  379.   imgRight.Picture = imgRight2.Picture
  380.   imgLeft.Picture = imgLeft1.Picture
  381.   MouseButton = 2
  382.  End If
  383. End Sub
  384. Sub imgSave_Click ()
  385.  imgSave.Picture = imgSave2.Picture    'depress save button
  386.  imgSave.Refresh                       'redraw button to show it is depressed
  387.  mnuSave_Click                         'save file
  388.  imgSave.Picture = imgSave1.Picture    'raise save button
  389. End Sub
  390. Sub mnuAbout_Click ()
  391. frmAbout.Show 1      'display the About dialog box - wait until OK is pressed before continuing
  392. End Sub
  393. 'Copyright 1995 by Hitoshi Ozawa
  394. Sub mnuAppend_Click ()
  395. 'Append a new bitmap image box to then end
  396. 'Change the width of the current form so that all bitmap boxes will be displayed
  397. If (picBitmaps(cntBitmaps - 1).Left + picBitmaps(cntBitmaps - 1).Width * 2) > frmMain.Width Then
  398.   frmMain.Width = picBitmaps(cntBitmaps - 1).Left + picBitmaps(cntBitmaps - 1).Width * 2.5
  399. End If
  400. 'Add a new element to the picBitmaps array
  401. Load picBitmaps(cntBitmaps)
  402. picBitmaps(cntBitmaps).Top = picBitmaps(0).Top
  403. picBitmaps(cntBitmaps).Left = picBitmaps(cntBitmaps - 1).Left + picBitmaps(cntBitmaps - 1).Width
  404. picBitmaps(cntBitmaps).Picture = LoadPicture()
  405. picBitmaps(cntBitmaps).BorderStyle = 0
  406. picBitmaps(cntBitmaps).Visible = True
  407. 'create corresponding imgBitmaps array
  408. Load imgBitmaps(cntBitmaps)
  409. imgBitmaps(cntBitmaps).Top = picBitmaps(cntBitmaps).Top
  410. imgBitmaps(cntBitmaps).Left = picBitmaps(cntBitmaps).Left
  411. imgBitmaps(cntBitmaps).Picture = LoadPicture()
  412. imgBitmaps(cntBitmaps).BorderStyle = 0
  413. imgBitmaps(cntBitmaps).Visible = True
  414. 'Create name field
  415. Load txtBitName(cntBitmaps)
  416. txtBitName(cntBitmaps).Top = txtBitName(0).Top
  417. txtBitName(cntBitmaps).Left = picBitmaps(cntBitmaps).Left
  418. txtBitName(cntBitmaps).Text = ""
  419. txtBitName(cntBitmaps).BackColor = RGB(256, 256, 256)
  420. txtBitName(cntBitmaps).Visible = True
  421. 'Increase number of bitmaps
  422. cntBitmaps = cntBitmaps + 1
  423. Form_resize
  424. End Sub
  425. 'Copyright 1995 by Hitoshi Ozawa
  426. Sub mnuBMPFile_Click ()
  427. Dim retcode As Integer
  428. 'Display the frmGetFile as modal
  429. frmGetFile.Show
  430. 'If not text file Execute file
  431. Select Case LCase$(Right$(frmGetFile.Tag, 3))
  432.  Case "exe"
  433.    retcode = Shell(frmGetFile.Tag, 1)
  434.  Case "com"
  435.    retcode = Shell(frmGetFile.Tag, 1)
  436.  Case "bat"
  437.    retcode = Shell(frmGetFile.Tag, 1)
  438.  Case "wri"
  439.    retcode = Shell("write.exe " & frmGetFile.Tag, 1)
  440.  Case Else   'if not any of above, treat at text file
  441.   'Get file number
  442.    FileNum = FreeFile
  443. End Select
  444. End Sub
  445. 'Copyright 1995 by Hitoshi Ozawa
  446. Sub mnuClear_Click ()
  447. 'make sure that element is selected
  448. If selBitmap < 0 Then
  449.   MsgBox ("Please selected an bitmap element")
  450.   Exit Sub
  451. End If
  452. 'Clear the selected bitmap
  453. imgBitmaps(selBitmap).Picture = LoadPicture()
  454. picBitmaps(selBitmap).Visible = True
  455. txtBitName(selBitmap).Text = ""
  456. txtBitName(selBitmap).BackColor = RGB(256, 256, 256)
  457. End Sub
  458. 'Copyright 1995 by Hitoshi Ozawa
  459. Sub mnuClose_Click ()
  460. 'Deselect current file
  461. 'Clear text area
  462. frmMain.Caption = ""                        'Clear main form caption
  463. 'Refresh frmGetfile
  464. frmGetFile.txtFileName.Text = ""            'Clear file name
  465. frmGetFile.filFiles.Pattern = "*.txt"       'Clear file selection
  466. frmGetFile.filFiles.Refresh                 'Redraw file selection dialog box
  467. End Sub
  468. Sub mnuContents_Click ()
  469. Dim RtnCode As Integer
  470. RtnCode = WinHelp(frmMain.hWnd, HelpFileName, HELP_CONTENTS, 0)
  471. If RtnCode = 0 Then
  472.  MsgBox ("Can not find BITLIN.HLP file.")
  473. End If
  474. End Sub
  475. 'Copyright 1995 by Hitoshi Ozawa
  476. Sub mnuCopy_Click ()
  477. 'make sure that element is selected
  478. If selBitmap < 0 Then
  479.   MsgBox ("Please selected an bitmap element")
  480.   Exit Sub
  481. End If
  482. 'clear border of bitmap to copy to clipboard
  483. imgBitmaps(selBitmap).BorderStyle = 0
  484. picBitmaps(selBitmap).BorderStyle = 0
  485. Clipboard.Clear      'clear clipboard area
  486. Clipboard.SetData imgBitmaps(selBitmap).Picture
  487. 'reset border of selected bitmap
  488. imgBitmaps(selBitmap).BorderStyle = 1
  489. picBitmaps(selBitmap).BorderStyle = 1
  490. End Sub
  491. 'Copyright 1995 by Hitoshi Ozawa
  492. Sub mnuDelete_Click ()
  493. Dim cnt
  494. 'make sure that at least one element is displayed
  495. If cntBitmaps = 0 Then
  496.   MsgBox ("Can not delete the last element")
  497.   Exit Sub
  498. End If
  499. 'make sure that element is selected
  500. If selBitmap < 0 Then
  501.   MsgBox ("Please selected an bitmap element")
  502.   Exit Sub
  503. End If
  504. 'move back pictures
  505. For cnt = selBitmap To cntBitmaps - 2
  506.   imgBitmaps(cnt).Picture = imgBitmaps(cnt + 1).Picture
  507.   picBitmaps(cnt).Visible = picBitmaps(cnt + 1).Visible
  508.   imgBitmaps(cnt).Visible = imgBitmaps(cnt + 1).Visible
  509.   txtBitName(cnt).Text = txtBitName(cnt + 1).Text        'move forward names
  510. 'Clear the last bitmap
  511. Unload imgBitmaps(cntBitmaps - 1)
  512. Unload picBitmaps(cntBitmaps - 1)
  513. Unload txtBitName(cntBitmaps - 1)
  514. cntBitmaps = cntBitmaps - 1
  515. If selBitmap = cntBitmaps Then
  516.   selBitmap = -1
  517.   imgBitmaps(selBitmaps).BorderStyle = 1
  518.   picBitmaps(selBitmaps).BorderStyle = 1
  519. End If
  520. End Sub
  521. 'Copyright 1995 by Hitoshi Ozawa
  522. Sub mnuExit_Click ()
  523. Dim RtnCode As Integer
  524. RtnCode = WinHelp(frmMain.hWnd, HelpFileName, HELP_QUIT, 0)
  525. If RtnCode = 0 Then
  526.  MsgBox ("Can not find BITLIN.HLP file.")
  527. End If
  528. End Sub
  529. Sub mnuHowto_Click ()
  530. RtnCode = WinHelp(frmMain.hWnd, HelpFileName, HELP_HELPONHELP, 0)
  531. If RtnCode = 0 Then
  532.  MsgBox ("Can not find BITLIN.HLP file.")
  533. End If
  534. End Sub
  535. 'Copyright 1995 by Hitoshi Ozawa
  536. Sub mnuInsert_Click ()
  537. Dim cnt
  538. 'make sure that element is selected
  539. If selBitmap < 0 Then
  540.   MsgBox ("Please selected an bitmap element")
  541.   Exit Sub
  542. End If
  543. 'append a new element
  544. mnuAppend_Click
  545. 'move back pictures
  546. For cnt = cntBitmaps - 1 To selBitmap + 1 Step -1
  547.   imgBitmaps(cnt).Picture = imgBitmaps(cnt - 1).Picture
  548.   picBitmaps(cnt).Visible = picBitmaps(cnt - 1).Visible
  549.   imgBitmaps(cnt).Visible = imgBitmaps(cnt - 1).Visible
  550.   txtBitName(cnt).Text = txtBitName(cnt - 1).Text        'move back names
  551. 'Clear the selected bitmap
  552. imgBitmaps(selBitmap).Picture = LoadPicture()
  553. picBitmaps(selBitmap).Visible = True
  554. txtBitName(selBitmap).Text = ""
  555. End Sub
  556. 'Copyright 1995 by Hitoshi Ozawa
  557. Sub mnuNew_Click ()
  558. 'Clear text area
  559. ODLSample.Clear
  560. frmMain.Caption = ""
  561. For cnt = cntBitmaps - 1 To 1 Step -1
  562.  Unload picBitmaps(cnt)
  563.  Unload imgBitmaps(cnt)
  564.  Unload txtBitName(cnt)
  565. ReDim startp(0 To 1) As Integer
  566. picBitmaps(0).Picture = LoadPicture()
  567. picBitmaps(0).Visible = True
  568. imgBitmaps(0).Picture = LoadPicture()
  569. txtBitName(0).BackColor = RGB(256, 256, 256)
  570. txtBitName(0).Text = ""
  571. selBitmap = -1
  572. cntBitmaps = 1
  573. End Sub
  574. 'Copyright 1995 by Hitoshi Ozawa
  575. Sub mnuOpen_Click ()
  576. 'Open lined bitmap image file
  577. frmGetFile.cmdOK.Default = True       'set OK button in file selection dialog box as a default selection
  578. frmGetFile.Show 1
  579. frmGetFile.cmdOK.Default = False
  580. If frmGetFile.Tag = "" Then
  581.  Exit Sub
  582. End If
  583. frmMain.Tag = txtHeight.Text
  584. frmOpen.Show 1
  585. mnuNew_Click
  586. For cnt = 0 To frmOpen.Tag - 1
  587.  If cnt > 0 Then
  588.    mnuAppend_Click
  589.  End If
  590.  imgBitmaps(cnt).Picture = frmOpen.picTemp(cnt).Image
  591.  picBitmaps(cnt).Visible = False
  592.  imgBitmaps(cnt).Refresh
  593.  If cnt > 0 Then
  594.   Unload frmOpen.picTemp(cnt)
  595.  End If
  596. End Sub
  597. 'Copyright 1995 by Hitoshi Ozawa
  598. Sub mnuPaste_Click ()
  599. 'make sure that element is selected
  600. If selBitmap < 0 Then                     'display a error message if not selected
  601.   MsgBox ("Please selected an bitmap element")
  602.   Exit Sub
  603. End If
  604. 'Display picture
  605. imgBitmaps(selBitmap).Picture = Clipboard.GetData()      'get image from a clipboard
  606. picBitmaps(selBitmap).Visible = False                    'hide picBitmaps() so imgBitmaps() is displayed
  607. End Sub
  608. 'Copyright 1995 by Hitoshi Ozawa
  609. Sub mnuSample_Click ()
  610. 'display selected bitmap images with text in ODList
  611. ReDim Preserve startp(0 To cntBitmaps) As Integer   'reset starting position of items
  612. Dim cnt
  613. 'clear previous ODList display
  614. ODLSample.Clear
  615. 'remove border before if any bitmap is selected copying bitmaps
  616. If selBitmap > -1 Then
  617.  picBitmaps(selBitmap).BorderStyle = 0  'Set border off
  618.  imgBitmaps(selBitmap).BorderStyle = 0  'Set border off
  619.  picBitmaps(selBitmap).Refresh          'redraw picture
  620.  imgBitmaps(selBitmap).Refresh          'redraw image
  621. End If
  622. picTemp.Picture = LoadPicture()          'clear temporary picture area (used to concatenate bitmaps)
  623. picTemp.Width = picBitmaps(0).Width * cntBitmaps   'Set width to total with of bitmaps
  624. picTemp.Height = picBitmaps(0).Height              'set height to be same as bitmaps
  625.                            'copy bitmap image to temporary area
  626. RtnCode = BitBlt(picTemp.hDC, 0, 0, picBitmaps(0).Width * cntBitmaps, picTemp.Height, picBitmaps(0).hDC, 0, 0, SRCCOPY)
  627. picTemp.Refresh                                    'redraw temporary bitmap
  628.                            'place it on top of bitmaps
  629. picTemp.Top = picBitmaps(0).Top + ODLSample.Height + picControl.ScaleHeight + 8
  630. picTemp.Left = picBitmaps(0).Left + 8
  631. 'redraw borders if any bitmap is selected
  632. If selBitmap > -1 Then
  633.  picBitmaps(selBitmap).BorderStyle = 1  'redraw borders
  634.  imgBitmaps(selBitmap).BorderStyle = 1  'redraw borders
  635.  picBitmaps(selBitmap).Refresh          'redraw picture
  636.  imgBitmaps(selBitmap).Refresh          'redraw image
  637. End If
  638. 'load bitmap image to display
  639. ODLSample.Picture = picTemp.Image       'set bitmap images to concatenated bitmap image
  640. picTemp.Visible = False                 'hide temporary bitmap image
  641. 'initialization
  642. ODLSample.BackColor = &HFFFFFF          'make background color white
  643. ODLSample.ItemBackColor = &HFFFFFF      'make bitimage background color white
  644. ODLSample.BitmapDivCnt = cntBitmaps     'define number of images contained in a BMP file
  645. ODLSample.ItemHeight = Val(txtHeight)   'define width of each bitmap image
  646. For cnt = 0 To cntBitmaps - 1
  647.  ODLSample.BitmapIndex = cnt            'set bitmap to use
  648.  ODLSample.StartPosition = startp(cnt)  'set x position of bitmap items
  649.  ODLSample.AddItem txtBitName(cnt)      'add item to the list
  650. End Sub
  651. 'Copyright 1995 by Hitoshi Ozawa
  652. Sub mnuSave_Click ()
  653. 'Save bitmap image to a file
  654. If fname = "" Then                  'Check if filename is defined - ie. it was saved once
  655.  frmGetFile.Hide                      'if not, then prompt for file name
  656.  frmGetFile.txtFileName.Text = ""
  657.  frmGetFile.Refresh
  658.  frmGetFile.cmdOK.Default = True
  659.  frmGetFile.Show 1
  660.  frmGetFile.cmdOK.Default = False
  661.  If frmGetFile.Tag = "" Then
  662.   Exit Sub
  663.  End If
  664.  fname = frmGetFile.Tag
  665. End If
  666. procSave                           'save bitmap images to a file
  667. End Sub
  668. 'Copyright 1995 by Hitoshi Ozawa
  669. Sub mnuSaveAs_Click ()
  670. 'save bitmap images with a new name
  671. frmGetFile.Hide                    'hide frmGetFile form to avoid simulatenous opening
  672. frmGetFile.txtFileName.Text = ""   'clear current file name
  673. frmGetFile.Refresh                 'redraw file name entry dialog so file name is cleared
  674. frmGetFile.cmdOK.Default = True    'set OK as a default button
  675. frmGetFile.Show 1                  'display the file entry dialog box
  676. frmGetFile.cmdOK.Default = False   'reset OK button so it is no longer a default
  677. If frmGetFile.Tag = "" Then        'check if file name was entered
  678.   Exit Sub                            'if not, then cancel this routine
  679. End If
  680. fname = frmGetFile.Tag             'set filename to a entered file name
  681. procSave                           'save bitmap image to file
  682. End Sub
  683. Sub mnuSearch_Click ()
  684. 'display search help dialog box
  685. RtnCode = WinHelp(frmMain.hWnd, HelpFileName, HELP_PARTIALKEY, 0)
  686. If RtnCode = 0 Then
  687.  MsgBox ("Can not find BITLIN.HLP file.")
  688. End If
  689. End Sub
  690. Sub ODLSample_DblClick (ListIndex%, List$)
  691. 'Move selected item to left or to the right
  692. Select Case MouseButton
  693.  Case 1                                   'move double-clicked image to left
  694.   startp(ListIndex%) = startp(ListIndex%) - 10      'move item 10 position to left
  695.   If startp(ListIndex%) < 0 Then          'if going past left of screen then reset to left margin
  696.     startp(ListIndex%) = 0
  697.   End If
  698.  Case 2                                  'move double-clicked image to right
  699.   startp(ListIndex%) = startp(ListIndex%) + 10        'move item 10 position to right
  700.  End Select
  701. mnuSample_Click                           'redraw ODList box
  702. End Sub
  703. 'Copyright 1995 by Hitoshi Ozawa
  704. Sub picBitmaps_Click (Index As Integer)
  705. If picBitmaps(Index).BorderStyle = 1 Then
  706.  picBitmaps(Index).BorderStyle = 0
  707.  imgBitmaps(Index).BorderStyle = 0
  708.  txtBitName(Index).BackColor = RGB(256, 256, 256)
  709.  selBitmap = -1
  710.  If selBitmap > -1 Then
  711.   picBitmaps(selBitmap).BorderStyle = 0  'Reset selected bitmap
  712.   imgBitmaps(selBitmap).BorderStyle = 0
  713.   txtBitName(selBitmap).BackColor = RGB(256, 256, 256)
  714.  End If
  715.  picBitmaps(Index).BorderStyle = 1      'Set selected bitmap
  716.  imgBitmaps(Index).BorderStyle = 1
  717.  txtBitName(Index).BackColor = RGB(160, 240, 120)
  718.  selBitmap = Index
  719. End If
  720. End Sub
  721. 'Copyright 1995 by Hitoshi Ozawa
  722. Sub picBitmaps_DragDrop (Index As Integer, Source As Control, X As Single, Y As Single)
  723. displayBMP Index
  724. End Sub
  725. 'Copyright 1995 by Hitoshi Ozawa
  726. Sub picBitmaps_DragOver (Index As Integer, Source As Control, X As Single, Y As Single, state As Integer)
  727. Select Case state
  728.   Case 0
  729.     'change icon when over
  730.     frmGetFile.filFiles.DragIcon = frmGetFile.picFile2
  731.   Case 1
  732.     'change icon to release
  733.     frmGetFile.filFiles.DragIcon = frmGetFile.PicFile1
  734. End Select
  735. End Sub
  736. 'Copyright 1995 by Hitoshi Ozawa
  737. Sub procSave ()
  738. 'Save current bitmap image to a file
  739. 'remove border before if any bitmap is selected copying bitmaps
  740. If selBitmap > -1 Then
  741.  picBitmaps(selBitmap).BorderStyle = 0  'Set border off
  742.  imgBitmaps(selBitmap).BorderStyle = 0  'Set border off
  743.  picBitmaps(selBitmap).Refresh          'redraw picture
  744.  imgBitmaps(selBitmap).Refresh          'redraw image
  745. End If
  746. picTemp.Picture = LoadPicture()          'clear temporary picture area (used to concatenate bitmaps)
  747. picTemp.Width = picBitmaps(0).Width * cntBitmaps   'Set width to total with of bitmaps
  748. picTemp.Height = picBitmaps(0).Height              'set height to be same as bitmaps
  749.                            'copy bitmap image to temporary area
  750. RtnCode = BitBlt(picTemp.hDC, 0, 0, picBitmaps(0).Width * cntBitmaps, picTemp.Height, picBitmaps(0).hDC, 0, 0, SRCCOPY)
  751. picTemp.Refresh                                    'redraw temporary bitmap
  752.                            'place it on top of bitmaps
  753. picTemp.Top = picBitmaps(0).Top + ODLSample.Height + picControl.ScaleHeight + 8
  754. picTemp.Left = picBitmaps(0).Left + 8
  755. 'redraw borders if any bitmap is selected
  756. If selBitmap > -1 Then
  757.  picBitmaps(selBitmap).BorderStyle = 1  'redraw borders
  758.  imgBitmaps(selBitmap).BorderStyle = 1  'redraw borders
  759.  picBitmaps(selBitmap).Refresh          'redraw picture
  760.  imgBitmaps(selBitmap).Refresh          'redraw image
  761. End If
  762. 'load bitmap image to display
  763. SavePicture picTemp.Image, fname
  764. picTemp.Visible = False                 'hide temporary bitmap image
  765. 'update file form
  766. frmGetFile.filFiles.Refresh
  767. End Sub
  768. Sub txtHeight_KeyPress (KeyAscii As Integer)
  769. If KeyAscii = 13 Then
  770.  txtHeight_LostFocus
  771. End If
  772. End Sub
  773. Sub txtHeight_LostFocus ()
  774. Dim cnt
  775. If txtHeight.Text = "" Then
  776.   txtHeight.Text = 34 * screen.TwipsPerPixelX
  777. End If
  778. 'Change size of bitmap display list
  779. For cnt = 0 To cntBitmaps - 1
  780.   picBitmaps(cnt).Width = Val(txtHeight.Text) * screen.TwipsPerPixelX
  781.   picBitmaps(cnt).Height = Val(txtHeight.Text) * screen.TwipsPerPixelY
  782.   picBitmaps(cnt).Left = picBitmaps(0).Left + (Val(txtHeight.Text) * screen.TwipsPerPixelX) * cnt
  783.   imgBitmaps(cnt).Width = picBitmaps(cnt).Width
  784.   imgBitmaps(cnt).Height = picBitmaps(cnt).Height
  785.   imgBitmaps(cnt).Left = picBitmaps(cnt).Left
  786.  'change name field properties
  787.  txtBitName(cnt).Width = picBitmaps(cnt).Width
  788.  txtBitName(cnt).Left = picBitmaps(cnt).Left
  789. Form_resize
  790. End Sub
  791.